﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Document_Add_Bottom.aspx.cs" Inherits="DocumentManage_Document_Add_Bottom" %>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
   <title>按钮页面</title>
    <link rel="stylesheet" href="../css/css.CSS"  type="text/css" />
    <script language="javascript" type="text/javascript">
     var sChoiceID;               //所在赋值的关键字
     var ChoiceNameInfo;          //选择的名称集合
     var ChoiceIDInfo;            //选择的ID集合
     var iChoicePoNumber1 =1;     //0表示任意多,其它的正整数为可以选择的最大个数.不可以为负数
     var iChoicePoNumber2 =3;     //0表示任意多,其它的正整数为可以选择的最大个数.不可以为负数
        
     var stype;
     function btnMageClk(type)
     {
        stype = type;
        form1.HID.value   = parent.LeftFrame.hidform.HID.value ;         //选择文件夹的ID
        form1.HPath.value = parent.LeftFrame.hidform.HPath.value ;       //选择文件夹的当前路径
        form1.HPaterPath.value = parent.LeftFrame.hidform.HPaterPath.value ;       //选择文件夹的当前路径
        var sFeatures  = "dialogHeight:300px;dialogWidth:400px;resizeable:no;help:no;status:no";
        var sFeatures2 = "dialogHeight:600px;dialogWidth:500px;resizeable:no;help:no;status:no";
        var sHID   = form1.HID.value;       
        switch (type)
        {
             case 1://增加
                    if(form1.HID.value == "" && form1.HPath.value =="")
                    {
                       alert("请选择文件夹");
                       return;
                    }
                    else
                    {
                        showModalDialog("Document_Edit.aspx?Type=1" ,window,sFeatures);
                        parent.LeftFrame.location.href = "Document_Add_Left.aspx";

//                        var btnRefresh=parent.LeftFrame.document.getElementById("BtnRefresh1");
//				        if(btnRefresh!=null)
//				           btnRefresh.click();	
                    }
                    break;
             case 2://修改
                    if(form1.HID.value == "" && form1.HPath.value =="")
                    {
                        alert("请选择要修改的文件夹");
                        return;
                    }
                    else
                    {
                        showModalDialog("Document_Edit.aspx?Type=2&DocID=" +form1.HID.value,window,sFeatures);  
                        parent.LeftFrame.location.href = "Document_Add_Left.aspx";

                        //location.href=location.href;   
//                        var btnRefresh=parent.LeftFrame.document.getElementById("BtnRefresh1");
//				        if(btnRefresh!=null)
//				           btnRefresh.click();                   
                    }			    
                    break;
            case 3: //删除
                    if(form1.HID.value == "" && form1.HPath.value =="")
                    {
                        alert("请选择要删除的文件夹");
                        return;
                    }
                    if(confirm("真的要删除该条记录？"))
                    {
				        var ifrmDel = parent.LeftFrame.document.getElementById("BtnCut");
				        if(ifrmDel!=null)
				        {
				          ifrmDel.click();
				        }
                    }                    
                    break;
             case 4: //上传文件
                    if(form1.HID.value == "" && form1.HPath.value =="")
                    {
                        alert("请选择要上传的文件夹");
                        return;
                    }
                    else
                    {
                        showModalDialog("Up_Doccument.aspx" ,window,sFeatures2);
                        var btnRefresh=parent.RightFrame.document.getElementById("BtnRefresh1");
				        if(btnRefresh!=null)
				           btnRefresh.click();
                    }
                    break;
             case 5: //删除    
                    if(form1.HID.value == "" && form1.HPath.value =="")
                    {
                        alert("请选择要删除的文件夹");
                        return;
                    }                
                    var btnRefresh=parent.RightFrame.document.getElementById("btnDelete");
				    if(btnRefresh!=null)
				        btnRefresh.click();                 
                    break;
             case 7: //软删除    
                    if(form1.HID.value == "" && form1.HPath.value =="")
                    {
                        alert("请选择要删除的文件夹");
                        return;
                    }  
                    if(confirm("确定要软删除选中的数据？"))
                    {
                        var btnRefresh=parent.RightFrame.document.getElementById("DeleteDoc");
				        if(btnRefresh!=null)
				            btnRefresh.click();     
				    }            
                    break;
             case 6: //移动
                    if(form1.HID.value == "" && form1.HPath.value =="")
                    {
                        alert("请选择要移动的文件夹");
                        return;
                    }
                    else
                    {
                      if(confirm("真的要移动该条记录？"))
                      {
                        var obj = showModalDialog("../Common/ChoiceFolders.aspx?ChoiceID=1",window,sFeatures2); 
                        if(obj != undefined)
                         {
                             sChoiceID = obj.sChoiceID;
                             ChoiceNameInfo = obj.ChoiceNameInfo;
                             ChoiceIDInfo=obj.ChoiceIDInfo;
                             if(ChoiceIDInfo !="")
                             {
                                 eval("parent.RightFrame.form1.HChoiceID.value ="+ChoiceIDInfo+";");
                                 //parent.RightFrame.form1.HChoiceID.value = ChoiceIDInfo;  //把选择得文件夹ID赋值到右边的页面                                 
                                 var ifrmDel = parent.RightFrame.document.getElementById("BtnMove");
				                if(ifrmDel!=null)
				                {
				                  ifrmDel.click();
				                }
				            }
				            else
				            {
				                alert("请选择文件夹");
				            }
                         }
                       }  
                    }                    
                    break;
         }
     }
    </script>
</head>
<body style =" background-image :url('../images/hit_bg.gif');"> 
<% 
  Response .ExpiresAbsolute=System.DateTime.Now. AddSeconds(-1);
  Response.Expires=0;
  Response.CacheControl = "no-cache";
%>
    <form id="form1" runat="server">
    <table align="center" style ="width :100%;" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td style ="width:40%;">
              <input id="Folder" type="hidden" name="Folder" runat="server" />
              <input id="Btn_1" type="button" runat ="server"  class="button03" onclick= "btnMageClk(1)"  value="新建(A)" accesskey ="a"/>     
              <input id="Btn_2" type="button" runat ="server" class="button03" onclick= "btnMageClk(2)"  value="修改(E)" accesskey ="e"  />        
              <input id="Btn_3" type="button" runat ="server" class="button03" onclick= "btnMageClk(3)"  value="删除(C)" accesskey ="c"  />
              <asp:Button ID="BtnCut" runat="server" Text="Button" Width="0px" Height="0px" OnClick="BtnCut_Click"   />
          </td>
          <td  align ="center" >
              <input id="Btn_11"  type="button" runat ="server" class="button06" onclick= "btnMageClk(4)"  value="上传文档(U)" accesskey ="u" />
              <input id="Btn_18" type="button" runat ="server" class="button06" onclick= "btnMageClk(7)"  value="软删除(D)" accesskey ="d"  />
              <input id="Btn_14" type="button" runat ="server" class="button06" onclick= "btnMageClk(5)"  value="删除文档(x)" accesskey ="x"  />
              <input id="Btn_13"  type="button" runat ="server" class="button06" onclick= "btnMageClk(6)"  value="移动文档(M)" accesskey ="m" />
          </td> 
        </tr>
      </table>
        <input type="hidden" id="HID" runat ="server"  /> 
        <input type="hidden" id="HPath" runat ="server"  />
        <input type="hidden" id="HPaterPath" runat ="server"  />
        <input type="hidden" id="HName" runat ="server" />
        <input type="hidden" id="hChildNumber" runat ="server" />
        <input type="hidden" id="hDOrder" runat ="server" />
        <input type="hidden" id="hEffective" runat ="server" />
        <input type="hidden" id="hParentName" runat ="server" />
        
        <input type="hidden" id="HChoiceID" runat ="server" />
    </form>
</body>
</html>